$(function () {
    getexrpessNoandBalance();
    getUserInfo();
});
function createCustomNavByRole(role) {
    /*支站点录入订单*/
    var subAddOrder = "<li class='active'>" +
        "<a href='jrd.html#/sub_station/add_order'>" +
        "<i class='icon-edit'></i> " +
        "<span>录入订单</span>" +
        "</a></li>";
    /*支站点来包处理*/
    var subPackageReceive = "<li class='active'>" +
        "<a href='jrd.html#/sub_station/packagereceive'>" +
        "<i class='icon-envelope'></i> " +
        "<span>来包处理</span>"+
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*支站点订单查询*/
    var subOrderInquire = "<li class='active'>" +
        "<a href='jrd.html#/sub_station/orderinquire'>" +
        "<i class='icon-search'></i> " +
        "<span>订单查询</span>" +
        "</a></li>";
    /*支站点退件详情*/
    var subOrderReturn = "<li class='active'>" +
        "<a href='jrd.html#/sub_station/orderreturn'>" +
        "<i class='icon-exclamation-sign'></i> " +
        "<span>退件详情</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*支站点派单处理*/
    var subSendOrder = "<li class='active'>" +
        "<a href='jrd.html#/sub_station/sendorder'>" +
        "<i class='icon-truck'></i> " +
        "<span>派单处理</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*中转站录入订单*/
    var trsfAddOrder ="<li class='active'>" +
        "<a href='jrd.html#/transfer_station/add_order'>" +
        "<i class='icon-edit'></i> " +
        "<span>录入订单</span>" +
        "</a></li>";
    /*中转站来件处理*/
    var trsfLetterReceive ="<li class='active'>" +
        "<a href='jrd.html#/transfer_station/letterreceive'>" +
        "<i class='icon-envelope-alt'></i> " +
        "<span>来件处理</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*中转站来包处理*/
    var trsfPackageReceive ="<li class='active'>" +
        "<a href='jrd.html#/transfer_station/packagereceive'>" +
        "<i class='icon-envelope'></i> " +
        "<span>来包处理</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*中转站订单查询*/
    var trsfOrderInquire ="<li class='active'>" +
        "<a href='jrd.html#/transfer_station/orderinquire'>" +
        "<i class='icon-search'></i> " +
        "<span>订单查询</span>" +
        "</a></li>";
    /*中转站派单处理*/
    var trsfSendOrder ="<li class='active'>" +
        "<a href='jrd.html#/transfer_station/sendorder'>" +
        "<i class='icon-truck'></i> " +
        "<span>派单处理</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*总台分配包裹*/
    var masterDistributePackage ="<li class='active'>" +
        "<a href='jrd.html#/master_station/distributepackage'>" +
        "<i class='icon-folder-open-alt'></i> " +
        "<span>分配包裹</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*总台发布通知*/
    var masterAnnounce ="<li class='active'>" +
        "<a href='jrd.html#/master_station/announce'>" +
        "<i class='icon-comments'></i> " +
        "<span>发布通知</span>" +
        "</a></li>";
    /*总台站点信息查询*/
    var masterInquireStaInfo ="<li class='active'>" +
        "<a href='jrd.html#/master_station/inquirestainfo'>" +
        "<i class='icon-zoom-in'></i> " +
        "<span>站点信息查询</span>" +
        "</a></li>";
    /*总台订单查询*/
    var masterOrderInquire ="<li class='active'>" +
        "<a href='jrd.html#/master_station/orderinquire'>" +
        "<i class='icon-search'></i> " +
        "<span>订单查询</span>" +
        "</a></li>";
    /*总台包裹查询*/
    var masterInquirePackage ="<li class='active'>" +
        "<a href='jrd.html#/master_station/packageinquire'>" +
        "<i class='icon-search'></i> " +
        "<span>包裹查询</span>" +
        "</a></li>";
    /*总台异常件处理*/
    var masterUnusualOrder ="<li class='active'>" +
        "<a href='jrd.html#/master_station/unusualorder'>" +
        "<i class='icon-exclamation-sign'></i> " +
        "<span>异常件处理</span>" +
        "<span class='num-dot black-dot' style='margin-left: 8px;'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*站点管理*/
    var siteManage ="<li class='active'>" +
        "<a href='jrd.html#/admin/sitemanage'>" +
        "<i class='icon-user'></i> " +
        "<span>站点管理</span>" +
        "</a></li>";
    /*地址管理*/
    var addrManage ="<li class='active'>" +
        "<a href='jrd.html#/admin/addrmanage'>" +
        "<i class='icon-user'></i> " +
        "<span>地址管理</span>" +
        "</a></li>";
    /*车站管理*/
    var busStationManage ="<li class='active'>" +
        "<a href='jrd.html#/admin/busstationmanage'>" +
        "<i class='icon-user'></i> " +
        "<span>车站管理</span>" +
        "</a></li>";
    /*同城服务台来件处理*/
    var localCityLetterReceive ="<li class='active'>" +
        "<a href='jrd.html#/localcity_master_station/localcityletterreceive'>" +
        "<i class='icon-envelope-alt'></i> " +
        "<span>同城来件</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*同城服务台派单处理*/
    var localCitySendOrder ="<li class='active'>" +
        "<a href='jrd.html#/localcity_master_station/localcitysendorder'>" +
        "<i class='icon-truck'></i> " +
        "<span>派单处理</span>" +
        "<span class='num-dot black-dot'>急</span>"+
        "<span class='num-dot'>3</span>"+
        "</a></li>";
    /*同城服务台订单查询*/
    var localCityInquireOrder ="<li class='active'>" +
        "<a href='jrd.html#/localcity_master_station/localcityinquireorder'>" +
        "<i class='icon-search'></i> " +
        "<span>订单查询</span>" +
        "</a></li>";
    /*大客户录入订单*/
    var vipAddOrder = "<li class='active'>" +
        "<a href='jrd.html#/vip/add_order'>" +
        "<i class='icon-edit'></i> " +
        "<span>录入订单</span>" +
        "</a></li>";
    /*大客户订单查询*/
    var vipInquireOrder ="<li class='active'>" +
        "<a href='jrd.html#/vip/inquireorder'>" +
        "<i class='icon-search'></i> " +
        "<span>订单查询</span>" +
        "</a></li>";
    if(role==1){
        $(".custom-nav").append(subAddOrder,subOrderInquire,subOrderReturn);
    }else if(role==2){
        $(".custom-nav").append(trsfAddOrder,trsfLetterReceive,trsfPackageReceive,trsfOrderInquire,trsfSendOrder);
    }else if(role==3){
        $(".custom-nav").append(masterDistributePackage,masterAnnounce,masterInquireStaInfo,masterOrderInquire,masterInquirePackage,masterUnusualOrder);
    }else if(role==4){
        $(".custom-nav").append(siteManage,addrManage,busStationManage);
    }
    else if(role==5){
        $(".custom-nav").append(subPackageReceive,subOrderInquire,subOrderReturn,subSendOrder);
    }else if(role==6){
        $(".custom-nav").append(subAddOrder,subPackageReceive,subOrderInquire,subOrderReturn,subSendOrder);
    }else if(role==7){
        $(".custom-nav").append(trsfLetterReceive,trsfPackageReceive,trsfOrderInquire,trsfSendOrder);
    }else if(role==8){
        $(".custom-nav").append(trsfAddOrder,trsfLetterReceive,trsfOrderInquire);
    }else if(role==9){
        $(".custom-nav").append(localCityLetterReceive,localCitySendOrder,localCityInquireOrder);
    }else if(role==10){
        $(".custom-nav").append(vipAddOrder,vipInquireOrder);
    }
}
function getexrpessNoandBalance() {
    $.getJSON("../order_check.json",function (msg) {
        if(msg.success==true){
            $(".top_expressNo").text(msg.ExpressNo);
            $(".top_balance").text(msg.Blance);
        }else{
            $(".top_expressNo").text("获取失败");
            $(".top_balance").text("获取失败");
        }
    })
}
function getUserInfo() {
    $.getJSON("../user_me.json",function (data){
        if(data.success==true) {
            var role = data.user.roles[0];
            $(".site_Maneger").html(data.user.stationAgent);
            $(".site_Station").html(data.user.stationName);
            createCustomNavByRole(role);
        }
    });
}